From bdaffc2e76830c35733781ed7319b80b4d0a08a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20H=C3=A4rdeman?= Date: Wed, 24 Sep 2025 15:38:12 +0200 Subject: [PATCH] dhcpv4: move find_assignment_by_hwaddr() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Move find_assignment_by_hwaddr() down to just before the sole user (dhcpv4_lease()). Signed-off-by: David Härdeman Link: https://github.com/openwrt/odhcpd/pull/264 Signed-off-by: Álvaro Fernández Rojas --- src/dhcpv4.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/dhcpv4.c b/src/dhcpv4.c index 2c6416b..a09c460 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -50,17 +50,6 @@ struct odhcpd_ref_ip { struct odhcpd_ipaddr addr; }; -static struct dhcp_assignment *find_assignment_by_hwaddr(struct interface *iface, const uint8_t *hwaddr) -{ - struct dhcp_assignment *a; - - list_for_each_entry(a, &iface->dhcpv4_assignments, head) - if (!memcmp(a->hwaddr, hwaddr, 6)) - return a; - - return NULL; -} - static void inc_ref_cnt_ip(struct odhcpd_ref_ip **ptr, struct odhcpd_ref_ip *ip) { *ptr = ip; @@ -400,6 +389,16 @@ static bool dhcpv4_assign(struct interface *iface, struct dhcp_assignment *a, return false; } +static struct dhcp_assignment *find_assignment_by_hwaddr(struct interface *iface, const uint8_t *hwaddr) +{ + struct dhcp_assignment *a; + + list_for_each_entry(a, &iface->dhcpv4_assignments, head) + if (!memcmp(a->hwaddr, hwaddr, 6)) + return a; + + return NULL; +} static struct dhcp_assignment* dhcpv4_lease(struct interface *iface, enum dhcpv4_msg msg, const uint8_t *mac, -- 2.30.2